#{extends 'relationsHome.html' /} 
#{set title:'Relation' /}
#{set 'moreStyles'}

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="@{'/public/stylesheets/forms.css'}">
<link rel="stylesheet" href="@{'/public/stylesheets/tables.css'}">
<link rel="stylesheet" href="@{'/public/stylesheets/main.css'}">
<link rel="stylesheet" href="@{'/public/stylesheets/list.css'}">
<link rel="stylesheet" href="@{'/public/stylesheets/css3buttons.css'}">


</head>


#{/set}

<div id=left>


<br/>
<h2 align="left"> Relations Created </h2>
<h4 align="left"> ${message} </h4>
#{if view.size() > 0}
<table id="rounded-corner" summary="All Relations" align="center" class="sortable">

    <thead>
    	<tr>
    	   #{if userType=="organizationLead" || userType=="organizer" || userType=="systemAdmin"}
    	    <th scope="col" class="rounded-unassign">Unassign</th>
           	<th scope="col" class="rounded-rename">Rename</th>
            #{/if}
        	<th scope="col" class="rounded-source">Source</th>
            <th scope="col" class="rounded-relationName">Name</th>
            <th scope="col" class="rounded-destination">Destination</th>
            <th scope="col" class="rounded-type">type</th>
            <th scope="col" class="rounded-postedAt">Post Date</th>
            <th scope="col" class="rounded-user.name">Author</th>
            
         
        </tr>
    </thead>
     #{list items:view, as:'relation'}
    <tbody>
     
    	<tr>
        	#{if userType=="organizationLead" || userType=="organizer" || userType=="systemAdmin"}
        	<td><a href="@{Relations.unassignRelation(relation.id)}" onclick="return confirm('Are you sure you want to delete this relation ?')"><span class="trash icon">Unassign  </a></td> 
            <td><a href="@{Relations.renameRelation(relation.id)}">Rename </a></td>
           #{/if}
        	<td>${relation.source}</td>
            <td>${relation.relationName}</td>
            <td>${relation.destination}</td>
            <td>${relation.type}</td>
            <td>${relation.postedAt}</td>
            <td>${relation.user.name}</td>
           
        </tr>
       
    </tbody>
   
     #{/list}
    
    </table>
   #{/if}
 #{else} No relations have been added yet #{/else}

</div>
